import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class GeneratePassword {
    public static void main(String[] args) {
        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        
        String password = "admin";
        String hash = encoder.encode(password);
        
        System.out.println("============================================================");
        System.out.println("密码: " + password);
        System.out.println("哈希: " + hash);
        System.out.println("============================================================");
        
        // 验证
        boolean matches = encoder.matches(password, hash);
        System.out.println("验证结果: " + (matches ? "SUCCESS" : "FAILED"));
        
        // 生成SQL
        System.out.println("\nSQL更新语句:");
        System.out.println("UPDATE users SET password_hash = '" + hash + "' WHERE nickname = 'admin';");
    }
}
